package regiserserver

import (
	"fmt"
	"rabbit/database"

	"github.com/urfave/cli"
)

var Cmdregister = cli.Command{
	Name:            "regiserserver",
	ShortName:       "rs",
	Usage:           "Run regiser server",
	SkipFlagParsing: true,
	SkipArgReorder:  true,
	Action: func(*cli.Context) error {
		fmt.Println("regiser server ready!")

		// 测试写入数据
		userObj := database.UserInfo{Uid: 100, UserName: "rabbit-im", Password: "123456"}
		userObj.AddOne()
		fmt.Println(userObj)

		friendsObj := database.UserRelationship{UidA: 100, UserATeamName: "张三"}
		friendsObj.AddOne()

		chatMsg := database.ChatMessages{SenderUid: 100, ReceiverUid: 2000, MsgContent: "你好，我是张三，您的外卖已到楼下，请下来取餐"}
		chatMsg.AddOne()
		return nil
	},
}
